<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>dips</title>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }
        html, body {
            height: 100%;
        }
        .demo {
            background: lightcyan;
            height: 100%;
            box-sizing: border-box;
            text-align: center;
            padding-top: 30px;
        }
    </style>
<!--     <script type="text/javascript">
    	window.onload = function() {
    		var w = window.innerWidth,
    			h = window.innerHeight
    		alert(w +','+ h);
    	}
    </script> -->
</head>
<body>
    <div class="demo">我的宽高等于视窗的宽高</div>
</body>
</html>